using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Globalization;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using ns16;

namespace ns20
{
	internal static class Class158
	{
		internal static class Class159
		{
			public const string string_0 = "Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";

			private const string string_1 = "Microsoft.CSharp.RuntimeBinder.Binder, Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";

			private const string string_2 = "Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo, Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";

			private const string string_3 = "Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";

			private const string string_4 = "Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags, Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";

			private static object object_0;

			private static object object_1;

			private static Delegate3<object, object> delegate3_0;

			private static Delegate3<object, object> delegate3_1;

			private static bool bool_0;

			private static void smethod_0()
			{
				if (!bool_0)
				{
					Type type = Type.GetType("Microsoft.CSharp.RuntimeBinder.Binder, Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", throwOnError: false);
					if (type == null)
					{
						throw new InvalidOperationException("Could not resolve type '{0}'. You may need to add a reference to Microsoft.CSharp.dll to work with dynamic types.".smethod_0(CultureInfo.InvariantCulture, "Microsoft.CSharp.RuntimeBinder.Binder, Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"));
					}
					int[] int_ = new int[1];
					object_0 = smethod_1(int_);
					object_1 = smethod_1(0, 3);
					smethod_2();
					bool_0 = true;
				}
			}

			private static object smethod_1(params int[] int_0)
			{
				Type type = Type.GetType("Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo, Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
				Type type2 = Type.GetType("Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
				Array array = Array.CreateInstance(type, int_0.Length);
				for (int i = 0; i < int_0.Length; i++)
				{
					MethodInfo method = type.GetMethod("Create", new Type[2]
					{
						type2,
						typeof(string)
					});
					object value = method.Invoke(null, new object[2] { 0, null });
					array.SetValue(value, i);
				}
				return array;
			}

			private static void smethod_2()
			{
				Type type = Type.GetType("Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo, Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", throwOnError: true);
				Type type2 = Type.GetType("Microsoft.CSharp.RuntimeBinder.CSharpBinderFlags, Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", throwOnError: true);
				Type type3 = Type.GetType("Microsoft.CSharp.RuntimeBinder.Binder, Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", throwOnError: true);
				Type type4 = typeof(IEnumerable<>).MakeGenericType(type);
				MethodInfo method = type3.GetMethod("GetMember", new Type[4]
				{
					type2,
					typeof(string),
					typeof(Type),
					type4
				});
				delegate3_0 = Class140.Class167_0.ns20_002EClass167_002E_206A_206E_200E_202E_206E_200B_200B_200E_202C_206A_202A_202B_200C_206A_206C_206D_202B_200F_206E_200F_202C_200D_200D_202B_202B_206F_206D_206E_206D_206B_200B_206B_200B_200E_200D_202E_202A_206C_200F_202B_202E<object>(method);
				MethodInfo method2 = type3.GetMethod("SetMember", new Type[4]
				{
					type2,
					typeof(string),
					typeof(Type),
					type4
				});
				delegate3_1 = Class140.Class167_0.ns20_002EClass167_002E_206A_206E_200E_202E_206E_200B_200B_200E_202C_206A_202A_202B_200C_206A_206C_206D_202B_200F_206E_200F_202C_200D_200D_202B_202B_206F_206D_206E_206D_206B_200B_206B_200B_200E_200D_202E_202A_206C_200F_202B_202E<object>(method2);
			}

			public static CallSiteBinder smethod_3(string string_5, Type type_0)
			{
				smethod_0();
				return (CallSiteBinder)delegate3_0(null, 0, string_5, type_0, object_0);
			}

			public static CallSiteBinder smethod_4(string string_5, Type type_0)
			{
				smethod_0();
				return (CallSiteBinder)delegate3_1(null, 0, string_5, type_0, object_1);
			}
		}

		public static IEnumerable<string> smethod_0(this IDynamicMetaObjectProvider idynamicMetaObjectProvider_0)
		{
			DynamicMetaObject metaObject = idynamicMetaObjectProvider_0.GetMetaObject(Expression.Constant(idynamicMetaObjectProvider_0));
			return metaObject.GetDynamicMemberNames();
		}
	}
}
